/**
 *
 */
package cn.hg.jfsa.manage.controller;

import java.util.List;

import com.jfinal.kit.StrKit;

import cn.hg.base.jfinal.controller.BaseController;
import cn.hg.jfsa.core.JfsaThreadLocal;
import cn.hg.jfsa.model.JfsaResource;
import net.sf.ehcache.CacheManager;

/**
 * @author Golly
 */
public class ManageIndexController extends BaseController {

	/**
	 * 清除缓存，包括管理端和页面端
	 */
	public void ajaxClearCache () {
		CacheManager.getInstance().removeAllCaches();
		this.renderAjaxSuccessed();
	}

	/**
	 * 此方法用于测试Error页面
	 */
	public void error () {
		Integer code = this.getInt("code", 500);
		String view = this.get("view");

		if (StrKit.notBlank(view)) {
			this.renderError(code, view);
		} else {
			this.renderError(code);
		}

	}

	/*
	 * (non-Javadoc)
	 * @see cn.hg.base.controller.BaseController#index()
	 */
	@Override
	public void index () {
		List<JfsaResource> menuList = JfsaThreadLocal.getAdminAuthMenu();
		this.setAttr("menuList", menuList);
	}

}
